using UnityEngine;

public class UIship : MonoBehaviour
{
	public Transform m_transform;

	public Vector3[] waypos;

	public int curwayindex;

	private Vector3 dir;

	public UIEventListener shipbtn;

	private void Start()
	{
		m_transform = base.transform;
		if (shipbtn != null)
		{
			shipbtn.onClick = onclickme;
		}
	}

	private void Update()
	{
		if (curwayindex != waypos.Length)
		{
			m_transform.Translate(0.01f * Time.deltaTime, 0f, 0f, Space.Self);
			dir = waypos[curwayindex] - m_transform.transform.localPosition;
			if (dir.magnitude < 10f)
			{
				curwayindex++;
			}
			else
			{
				m_transform.right = Vector3.Lerp(m_transform.right, dir, 0.005f * Time.deltaTime);
			}
		}
	}

	public void onclickme(GameObject btn)
	{
		MenuUIController.instance.enable_hitinfoui(hitinfoid.ship_click);
	}
}
